<template>
  <router-view></router-view>
</template>
<script setup lang="ts">
import { usePremsStore } from "@/store/modules/prems";

const router = useRouter();
const route = useRoute();
const premsStore = usePremsStore();

const setRouter = () => {
  if (premsStore.isMenuActivity) {
    if (route.path == "/admin/activity") {
      router.replace("/admin/activity/discount");
    }
  } else {
    router.push("/admin/main");
  }
};
watch(
  () => route.path,
  () => {
    nextTick(() => {
      setRouter();
    });
  }
);
onMounted(() => {
  setRouter();
});
</script>
